package com.ruoyi.business.service.impl;

import java.util.Date;
import java.util.List;

import com.ruoyi.business.service.IBusHardwareCheckTimeCommonUpdateService;
import com.ruoyi.business.service.IBusHardwareStatusCommonUpdateService;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.business.mapper.BusDeviceMapper;
import com.ruoyi.business.domain.BusDevice;
import com.ruoyi.business.service.IBusDeviceService;

/**
 * 平台设备Service业务层处理
 * 
 * @author asher
 * @date 2021-10-17
 */
@Service
public class BusDeviceServiceImpl implements IBusDeviceService, IBusHardwareStatusCommonUpdateService, IBusHardwareCheckTimeCommonUpdateService
{
    @Autowired
    private BusDeviceMapper busDeviceMapper;

    /**
     * 查询平台设备
     * 
     * @param deviceId 平台设备主键
     * @return 平台设备
     */
    @Override
    public BusDevice selectBusDeviceByDeviceId(Long deviceId)
    {
        return busDeviceMapper.selectBusDeviceByDeviceId(deviceId);
    }

    /**
     * 查询平台设备列表
     * 
     * @param busDevice 平台设备
     * @return 平台设备
     */
    @Override
    public List<BusDevice> selectBusDeviceList(BusDevice busDevice)
    {
        return busDeviceMapper.selectBusDeviceList(busDevice);
    }

    /**
     * 新增平台设备
     * 
     * @param busDevice 平台设备
     * @return 结果
     */
    @Override
    public int insertBusDevice(BusDevice busDevice)
    {
        busDevice.setCreateTime(DateUtils.getNowDate());
        return busDeviceMapper.insertBusDevice(busDevice);
    }

    /**
     * 修改平台设备
     * 
     * @param busDevice 平台设备
     * @return 结果
     */
    @Override
    public int updateBusDevice(BusDevice busDevice)
    {
        busDevice.setUpdateTime(DateUtils.getNowDate());
        return busDeviceMapper.updateBusDevice(busDevice);
    }

    /**
     * 批量删除平台设备
     * 
     * @param deviceIds 需要删除的平台设备主键
     * @return 结果
     */
    @Override
    public int deleteBusDeviceByDeviceIds(Long[] deviceIds)
    {
        return busDeviceMapper.deleteBusDeviceByDeviceIds(deviceIds);
    }

    /**
     * 删除平台设备信息
     * 
     * @param deviceId 平台设备主键
     * @return 结果
     */
    @Override
    public int deleteBusDeviceByDeviceId(Long deviceId)
    {
        return busDeviceMapper.deleteBusDeviceByDeviceId(deviceId);
    }

    @Override
    public int updateStatusByDestRecordId(Long destRecordId, int destStatus, Date updateTime) {
        return busDeviceMapper.updateStatusByDestRecordId(destRecordId, destStatus, updateTime);
    }

    @Override
    public int updateCheckTimeByDestRecordId(Long destRecordId, Date checkTime, String checkCompany) {
        return busDeviceMapper.updateCheckTimeByDestRecordId(destRecordId, checkTime, checkCompany);
    }
}
